<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta content="always" name="referrer">
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<!-- 移动端必须的设置 -->
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<!-- 禁用电话号码检测功能，禁止对数字随便可以拨号 -->
<meta name="format-detection" content="telephone=no">
<!-- 禁用E-mail检测功能 -->
<meta name="format-detection" content="email=no">
<!-- 禁用地址检测功能，禁止跳转到地图 -->
<meta name="format-detection" content="address=no">
<!-- 在苹果设备上以全屏方式打开本网页 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- 设置在苹果设备上状态的颜色，默认白色，要设置成什么颜色以Web颜色的风格而定 -->
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<title>途狗收油</title>
<script type="text/javascript" src="../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../js/base64.js"></script>
<script type="text/javascript" src="../js/layui/layui.js "></script>
<script type="text/javascript" src="../js/recycle/appointment.js?version=2.3.4"></script>
<!--  <script type="text/javascript" src="../vendor/resize.js"></script>-->
<link rel="stylesheet" href="../js/layui/css/layui.css" />
<link rel="stylesheet" href="../vendor/iconfont/iconfont.css" />
<link rel="stylesheet" href="../css/register.css" />
<link rel="stylesheet" href="../css/basestyle.css" />
<link rel="stylesheet" href="../busi/css/aui.css" />
<link rel="stylesheet" href="../busi/css/index.css" />
<script type="text/javascript" src="../js/popupstyle.js"></script>
</head>
<body>
	<%@ include file="../basejsp.jsp"%>
		<div class="index-logoBox">
			<div class="index-logo"></div>
		</div>
		<div class="index-formBox">
			<form class="index-formBox-form">
				<div class="index-formBox-title">登陆</div>
				<div class="index-formBox-input">
					<i class="aui-iconfont aui-icon-my"></i>
					<input id="username"  type="text" placeholder="手机号码/账号" />
				</div>
				<div class="index-formBox-input">
					<i class="aui-iconfont aui-icon-unlock"></i>
					<input id="password" type="password" placeholder="输入密码" />
				</div>
				<button type="button"  onclick="busilogin()" class="index-formBox-input ">确定</button>
			</form>
		</div>
		<script type="text/javascript">
		
		function busilogin(){
			var m = $("#username").val();
			if(!m.match(/^1[34578]\d{9}$/)) {
				layer.msg('输入有效的手机号');
				/* tippopup("#mobile","输入有效的手机号")*/
			}else{
				var username = encode64($("#username").val());
				var password = encode64($("#password").val());
				var json = {
					"username": "" + username + "",
					"password": "" + password + "",
				}
				$.ajax({
					cache: false,
					type: "post",
					datatype: 'json',
					contentType: 'application/json;charset=UTF-8',
					url: ''+httpipstr+'alfa-mobile-ws/rest/user/loginforwap',
					data: JSON.stringify(json),
					success: function(data) {
						if (data.message=="7") {
							setcookie("phonebusiuser", data.data.user.phone, 30, "/");
							setcookie("mobiletokenuserbusiuser", data.data.user.mobiletoken, 30, "/");
							setcookie("usernamebusiuser", data.data.user.username, 30, "/");
							setcookie("useridbusiuser", data.data.user.userId, 30, "/"); 
							setcookie("JSESSIONID", data.data.id, 30, "/");
							//触发事件
							layer.closeAll();
							location.href="../busiuser/busilist.jsp";
						}else if(data.message=="5"){
							layer.msg('帐号不存在');
						}else if(data.message=="8"){
							layer.msg('您的角色非业务人员，无法登录');
						}else if(data.message=="10"){
							layer.msg('管理员审核中，请稍等');
						}else{
							layer.msg('密码错误');
						}
					}
		  		});
			}
		}
	</script>
</body>
</html>